<template>
  <svg aria-hidden="true" class="svg-icon">
    <use :href="symbolId" :fill="color" />
  </svg>
</template>

<script lang="ts" setup>
import { computed } from 'vue'

interface IProps {
  name: string
  color?: string
}
const props = withDefaults(defineProps<IProps>(), {
  name: '',
  color: 'inherit'
})
const symbolId = computed(() => `#icon-${props.name}`)
</script>
<style scope>
.svg-icon {
  width: 16px;
  height: 16px;
  line-height: 16px;
  cursor: pointer;
  color: v-bind('$props.color') !important;
  fill: currentColor;
}
</style>
